import java.util.ArrayList;

public class Problem10 {

    public static void main(String[] args) {
	long countTwo = 0l;
	int counterThree = 0;
	long countersum = 2;
	ArrayList<Integer> arr = new ArrayList<Integer>();
	arr.add(0, 2);
	for (int i = 3; i < 100000000; i++) {

	    if (countTwo > 2000000) {
		break;
	    }
	    int counter = 0;
	    if (i % 2 != 0 || i == 2) {
		if (countTwo > 2000000) {
		    break;
		}
		for (int j = 0; j < arr.size(); j++) {
		    if (i % (arr.get(j)) == 0) {
			break;
		    }
		    if ((j+1) == arr.size()) {
			counter = 2;
			arr.add(i);
			break;
		    } else
			continue;
		}

	    }
	    if (counter == 2) {
		countTwo = i;
		counterThree++;
		if (countTwo > 2000000) {

		    break;
		}
		countersum = countersum + countTwo;

	    }

	}
	System.out.println(countersum);
    }

}
